﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PingSwitch
{
    public partial class frmAddComputers : Form
    {
        frmPingSwitch MainForm;
        // The constructor receives a reference to mainform.
        public frmAddComputers(frmPingSwitch frmMain, string[] lines)
        {
            InitializeComponent();
            MainForm = frmMain;
            tbComputerList.Lines = lines;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            addHosts();
            this.Close();
        }

        private void addHosts()
        {
            MainForm.clearBindingList();
            string[] lines = tbComputerList.Lines;
            MainForm.loadHostList(lines);
        }
    }
}
